home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Harmless / Eyecon / Source / InfoView.m < prev    next >
Encoding:
Text File  |  1994-04-01  |  1.6 KB  |  88 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "InfoView.h"
  5. #import "info.h"
  6. #import <appkit/Application.h>
  7. #import <appkit/nextstd.h>   // For MAX
  8. #import <appkit/Text.h>
  9. #import <appkit/Font.h>
  10. #import <string.h>
  11.  
  12. @implementation InfoView
  13.  
  14. + newFrame:(NXRect *)frm
  15. {
  16.   self = [super newFrame:frm];
  17.   font = [Font newFont:"Times-Bold" 
  18.            size:MAX(floor(frm->size.width * 0.095), 6.0)
  19.            style:0
  20.            matrix:NX_IDENTITYMATRIX];  // We are using PSshow, not 
  21.                        // the Text class...
  22.   if (font == nil) font = [Text getDefaultFont];
  23.   [self setClipping:NO];
  24.   return (self);
  25. }
  26.  
  27. - drawLogo
  28. {
  29.     float w,h;
  30.         
  31.     [self lockFocus];
  32.     d += 0.025;
  33.     if (d <=1.0) {
  34.         PSdrawBeams(bounds.size.width,bounds.size.height,d);
  35.     } else {
  36.         [font set];
  37.         PSsetgray(NX_WHITE);
  38.         PSstringwidth ("Lighthouse Design, Ltd.", &w, &h);
  39.           PSmoveto (bounds.size.width/2.0 - w/2.0, bounds.size.width / 30.0);
  40.         PSshow("Lighthouse Design, Ltd.");
  41.         drawnOnce = YES;
  42.         drawing = NO;
  43.         DPSRemoveTimedEntry(timedEntry);
  44.     }
  45.     [[self window] flushWindow];
  46.     [self unlockFocus];
  47.     return (self);
  48. }
  49.  
  50. void infoTimerFunction(DPSTimedEntry te, double timenow, void *data)
  51. {
  52.     [(id)data drawLogo];
  53. }
  54.  
  55.  
  56. - windowDidBecomeKey:sender
  57. {
  58.  
  59.     if (!(drawnOnce||drawing)) {
  60.         PSInit();
  61.         d = 0.0;
  62.         timedEntry = DPSAddTimedEntry(0.01, &infoTimerFunction, self, NX_BASETHRESHOLD);
  63.         drawing = YES;
  64.     }
  65.     return (self);
  66. }
  67.  
  68. - drawSelf:(NXRect *)rects :(int)rectCount
  69. {
  70.   PSsetgray (NX_BLACK);
  71.   NXRectFill (&bounds);
  72.   return (self);
  73. }
  74.  
  75. - windowWillClose:sender
  76. {
  77.     if (drawing)
  78.         DPSRemoveTimedEntry(timedEntry);
  79.     drawing = drawnOnce = NO;
  80.     [self lockFocus];
  81.     [self drawSelf:0 :0];
  82.     [self unlockFocus];
  83.     return self;
  84. }
  85.  
  86.  
  87. @end
  88.